package com.engine4cloud.tdf.supervision.convert;

import com.engine4cloud.tdf.common.core.util.CodeUtils;
import com.engine4cloud.tdf.supervision.dto.create.KhjcAdmonishCreateDTO;
import com.engine4cloud.tdf.supervision.dto.result.KhjcAdmonishResultDTO;
import com.engine4cloud.tdf.supervision.dto.update.KhjcAdmonishUpdateDTO;
import com.engine4cloud.tdf.supervision.entity.KhjcAdmonishEntity;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;

@Mapper
public interface KhjcAdmonishConvert {
    KhjcAdmonishConvert INSTANCE = Mappers.getMapper(KhjcAdmonishConvert.class);

    KhjcAdmonishResultDTO convert(KhjcAdmonishEntity s);

    KhjcAdmonishEntity createTo(KhjcAdmonishCreateDTO s);

    KhjcAdmonishEntity update(KhjcAdmonishUpdateDTO s);

    default KhjcAdmonishEntity create(KhjcAdmonishCreateDTO s, Long tenantId) {
        KhjcAdmonishEntity entity = createTo(s);
        entity.setTenantId(tenantId);
        entity.setLcbh(CodeUtils.entrustCode());
        return entity;
    }
}
